import 'babel-polyfill'
import 'classlist-polyfill'
import Vue from 'vue'
// import axios from './router/axios'
import VueAxios from 'vue-axios'
import App from './App'
import zhLocale from './lang/zh'
import './permission' // 权限
import './error' // 日志
import './cache'//页面缓冲
import router from './router/router'
import store from './store'
import permission from './directive/index'

import L from "leaflet"
// import * as L from 'leaflet';
import 'leaflet/dist/leaflet.css';
// import 'leaflet.pm';
// import 'leaflet.pm/dist/leaflet.pm.csss';


import * as urls from '@/config/env'
import * as filters from './filters' // 全局filter
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './styles/layout.scss'
// import * as echarts from 'echarts'
import 'echarts';
import VueEcharts from 'vue-echarts'

import MyDateRange from '@/components/MyDateRange'
import http from '@/assets/js/http.js'
import util from '@/assets/js/util.js'
import verify from '@/assets/js/verify.js'
import icon from '@/assets/js/icon.js'
import moment from 'moment';

// 挂载常用全局方法，import 引入
Vue.prototype.$request = http // 请求方法
Vue.prototype.$util = util // 工具集合
Vue.prototype.$verify = verify // 表单验证
Vue.prototype.$icon = icon // 本地图标
Vue.prototype.$moment = moment;
// Vue.prototype.$L = L;
// leaflet icon
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
  iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
  iconUrl: require('leaflet/dist/images/marker-icon.png'),
  shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});

Vue.config.productionTip = false;
Vue.L = Vue.prototype.$L = L;

// DictResolver.install()

// 插件 json 展示
Vue.use(router)
// 表单设计器

// window.axios = axios
// Vue.use(VueAxios, axios)

Vue.use(ElementUI, {
  size: 'small',
  menuType: 'text'
})

// 全局修改默认配置，点击空白处不能关闭弹窗
ElementUI.Dialog.props.closeOnClickModal.default=false;

Vue.use(AVUE, {
  locale: zhLocale,
  size: 'small',
  menuType: 'text'
})

Vue.use(permission)
// 注册全局容器
Vue.component('v-chart',VueEcharts)
// 全局组件挂载
Vue.component('MyDateRange', MyDateRange)

// 加载相关url地址
Object.keys(urls).forEach(key => {
  Vue.prototype[key] = urls[key]
})

// 加载过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})


Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
